<template>
  <div class="layout">
    <div class="">
        <router-view/>
     
    </div>

    <van-tabbar v-model="active" route>
      <van-tabbar-item to="/article" icon="notes-o" name="Login">面经</van-tabbar-item>
      <van-tabbar-item to="/collect" icon="star-o" name="Register">收藏</van-tabbar-item>
      <van-tabbar-item to="/like" icon="like-o" name="Detail">喜欢</van-tabbar-item>
      <van-tabbar-item to="/user" icon="user-o" name="Layout">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      active: 'Login',
    };
  },

  beforeCreate(){
if(!localStorage.getItem('token')){
  this.$router.push({path:'/login'})
}
  },
};
</script>

<style scoped lang=less>
.van-tabbar {
    background-color: rgb(143, 163, 170);

    .van-tabbar-item--active{
        background-color: rgb(155, 180, 159);
        color: azure;
    }
}
</style>